local skel = fk.CreateSkill {
  name = "emo__shaoguang",
  derived_piles = "$emo__shaoguang",
}

Fk:loadTranslationTable{
  ["emo__shaoguang"] = "韶光",
  [":emo__shaoguang"] = "游戏开始时，你将牌堆顶七张牌扣置于武将牌上，称为“韶光”；准备阶段和结束阶段，你可以用任意张手牌替换等量的“韶光”。",

  ["$emo__shaoguang"] = "韶光",
  ["#emo__shaoguang-exchange"] = "韶光：你可以用任意张手牌替换等量的“韶光”",

  ["$emo__shaoguang1"] = "御龙凌霄！",
  ["$emo__shaoguang2"] = "云螭鳞闪！",
}

skel:addEffect(fk.GameStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    player:addToPile("$emo__shaoguang", player.room:getNCards(7), false, skel.name)
  end,
})

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and
      not player:isKongcheng() and #player:getPile("$emo__shaoguang") > 0
      and (player.phase == Player.Start or player.phase == Player.Finish)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cids = room:askToArrangeCards(player, {
      skill_name = skel.name,
      card_map = {
        player:getPile("$emo__shaoguang"), player:getCardIds("h"),
        "$emo__shaoguang", "$Hand"
      },
      prompt = "#emo__shaoguang-exchange",
      free_arrange = true,
    })
    room:swapCardsWithPile(player, cids[1], cids[2], skel.name, "$emo__shaoguang")
  end,
})

return skel
